package com.yanqu.road.server.cmd.activity.springunionbanquet;

import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.SpringUnionBanquetProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.activity.springunionbanquet.CrossSpringUnionBanquetActivity;
import com.yanqu.road.server.manager.activity.springunionbanquet.CrossSpringUnionBanquetActivityMgr;
import com.yanqu.road.server.protocol.Protocol;

import java.util.ArrayList;

@Cmd(code = Protocol.C_SPRING_UNION_BANQUET_UNION_TOP, desc = "商会top")
public class CrossSpringUnionBanquetUnionTopCmd extends CrossCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {

        SpringUnionBanquetProto.CrossSpringUnionBanquetUnionTopReqMsg topReqMsg = SpringUnionBanquetProto.CrossSpringUnionBanquetUnionTopReqMsg.parseFrom(packet.getBytes());
        int activityId = topReqMsg.getActivityId();
        CrossSpringUnionBanquetActivity activity = CrossSpringUnionBanquetActivityMgr.getActivity(activityId);
        if(activity != null){
            activity.syncTopUser(topReqMsg.getUnionUid(), serverId, packet.getPlayerId(), new ArrayList<>(topReqMsg.getMemberIdList()));
        }

    }

    @Override
    public void sendData() {

    }
}
